#ifndef HMS_FIELD_MEMBER_MACROS
#define HMS_FIELD_MEMBER_MACROS


#define FIELD_MEMBER(NAME) \
std::experimental::observer_ptr<const Field<MeshType>> m_##NAME {nullptr};

#define FIELD_ACCESSORS(NAME, N_COMPONENTS) \
auto NAME() const -> const Field<MeshType>& { \
	assert( m_##NAME ); \
	return *m_##NAME; \
} \
void NAME( const Field<MeshType>& arg ){ \
	assert(arg.nComponents() == N_COMPONENTS); \
	m_##NAME = std::experimental::make_observer<const Field<MeshType>>( &arg ); \
}

#define D_FIELD_MEMBER FIELD_MEMBER(dField)
#define Z_FIELD_MEMBER FIELD_MEMBER(zField)
#define V_FIELD_MEMBER FIELD_MEMBER(vField)

#define D_FIELD_ACCESSORS FIELD_ACCESSORS(dField, 1)
#define Z_FIELD_ACCESSORS FIELD_ACCESSORS(zField, 1)
#define V_FIELD_ACCESSORS FIELD_ACCESSORS(vField, 2)


#endif